<template>
  <div>
    <el-dialog :visible.sync="exploreVisible.v"
               width="44%" title="并行模型">
      <!--<h4 style="margin-bottom: 30px">并行模型</h4>-->
      <el-radio-group @change="selectRadio" v-model="radio">
        <el-radio :label="item.val" v-bind:key="item.val" v-for="(item,index) in selectUploadone">{{item.lab}}</el-radio>
      </el-radio-group>

     <div v-if="selectIndex === 1">
       <v_statistic ref="stat" v-on:childOpen="openPosition"></v_statistic>
     </div>
      <div v-if="selectIndex === 0">
        <v_query ref="quer" v-on:childOpen="openPosition"></v_query>
      </div>
      <span>
          <el-button type="primary" style="margin-left:62%;margin-top: 20px" @click="submit">确定</el-button>
          <el-button style="margin-left:20px" @click="cancel">取消</el-button>
      </span>
    </el-dialog>
    <div>
      <v_areaDialog :areaVisible="areaVisible"></v_areaDialog>
    </div>
  </div>
</template>

<script>
  import statistic from '../../components/div/statistic';
  import query from '../../components/div/query';
  import areaDialog from '../../components/dialog/areaDialog';

  export default {
    name: "explore-dialog",
    data() {
      return {
          inputAttr: '',
          dataField:'',

        paramsFormData: '',
        radio:2,
        selectIndex:2,
        selectUploadone:[
          { lab: "统计", val: 1 },
          { lab: "查询", val: 0 }
        ],
          areaVisible: {
              v: false
          },
      }
    },
    components: {
        "v_areaDialog": areaDialog,
        "v_statistic": statistic,
        "v_query":query,
    },
    props: {
      exploreVisible: Object,
    },
    methods: {
      submit() {
          if(this.selectIndex===1){
              this.$refs.stat.statSubmit();
          }
          else if(this.selectIndex===0){
              this.$refs.quer.querySubmit();
          }
          this.exploreVisible.v=false;
      },
      cancel() {
        this.radio='2';
        this.selectIndex=2;
        this.exploreVisible.v = false;
      },
      selectRadio(val){
        this.selectIndex=val;
      },
      openPosition() {
          this.$Bus.$emit('areaVisible.v', true);
      },
    },
    mounted() {
      this.radio='2';
      this.selectIndex=2;
    },
    created() {
      this.$Bus.$on('exploreVisible.v', (e) => {
        this.exploreVisible.v = e;
      });
    },
  }
</script>

<style>
  #icon:hover {
    color: #409EFF;
  }
</style>
